package com.mi.system.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mi.system.dto.query.DeptQueryDTO;
import com.mi.system.dto.request.DeptRequestDTO;
import com.mi.system.entity.Dept;
import com.mi.system.vo.DeptTreeVO;
import com.mi.system.vo.DeptVO;

import java.util.List;

/**
 * Dept service
 *
 * @author jin_huaquan
 * @version 1.0
 * @date 2021/11/1 13:51
 */
public interface DeptService extends IService<Dept> {

    /**
     * list dept
     *
     * @param page  page info
     * @param query query params
     * @return dept list
     */
    IPage<DeptVO> listDept(Page page, DeptQueryDTO query);

    /**
     * list dept
     *
     * @param query query params
     * @return dept list
     */
    List<DeptVO> listDept(DeptQueryDTO query);

    /**
     * List child dept tree
     *
     * @param parentId parent id
     * @return dept tree list
     */
    List<DeptTreeVO> listDeptTree(Long parentId);

    /**
     * save dept
     *
     * @param request dept info
     * @return result
     */
    boolean saveDept(DeptRequestDTO request);

    /**
     * update dept
     *
     * @param id      dept id
     * @param request dept info
     * @return result
     */
    boolean updateDept(Long id, DeptRequestDTO request);

    /**
     * remove dept
     *
     * @param id dept id
     * @return result
     */
    Dept removeDept(Long id);
}
